There are many cases where it is necessary to execute the exact same executable code on a plurality of processors and to provide fast memory access to data on a per-processor basis. According to prior art techniques, the executable code is copied for each processing unit instance into physical memory in a different location and executed therefrom, with further allocation for each processing unit storing data memory. In cache-based systems, the repeated copying or instancing of the same instructions into different areas of the memory often results in waste and thrashing of the cache content, thereby lowering performance or requiring larger memories.
In the Intel® IA-32e and Advanced Micro Devices® (AMD) 64-bit processors' architectures, the legacy GS register (which is used for segmentation addressing in 32-bit mode) is retained in vestigial form for use as an extra base pointer to operating system structures in 64-bit addressing space. The fast access to per-processor structure is possible with the use of the new kernel GS register and a “swapgs” instruction. This allows to somewhat overcome the problems discussed above with regard to the copying of the code. However, if GS and/or kernel GS registers are in use by a guest operating system of a virtual machine (VM), these registers cannot be used by the hypervisor's code to access the per-processor structures of the hypervisor itself.
A guest operating system (or simply “guest”) is an operating system that is installed on a virtual machine in addition to the host (main) operating system running on the hardware system. A guest is controlled by a hypervisor. The hypervisor presents to the guest a virtual operating platform and manages the execution of the guest. Multiple instances of operating systems may share the virtualized hardware resources. In full virtualization architecture, the hypervisor sufficiently simulates the hardware on which the guest executes, such that no modification is required to the guest. Another virtualized environment is para-virtualization in which a software interface is used to allow the handling and modifying of the guest.
Regardless of the virtualization environment, or otherwise, current solutions for support execution of the same portions of code by multiple processors requires either copying of the code, or does not allow sharing of the GS registers.
It would be therefore advantageous to provide a solution that overcomes the deficiencies of the prior art.